The invention relates to a method for writing user data into an optical disc data, and more particularly, to a data managing method for an optical disc drive writing user data into an optical disc having defects.
Recently, due to the low cost, tiny weight and volume, yet high capacity, the optical disc has become one of the most popular data-storing media in the information technology industry. Moreover, the invention of the recordable optical disc allows users to write their personal data into the optical disc. As a result, optical discs have grown to become one of the most important personal portable storing devices. Hence, increasing the stability and efficiency of recordable optical disc data accessing is a key point in the information technology industry.
Typically, the data on the optical disc is stored or read through the optical disc drive. Please refer to FIG. 1. FIG. 1 is a block diagram of a conventional optical disc drive 10. The optical disc drive 10 is utilized for accessing (i.e., storing data into and reading data from) an optical disc 22. As shown in FIG. 1, the optical disc drive 10 includes a carrier 14, a motor 12 for driving the carrier 14 to rotate, a pick-up head 16 for storing and reading data on the optical disc 22, a control circuit 18 for controlling the operation of the motor 12 and the pick-up head 16, and a memory 20 (e.g., a volatile random access memory) for buffering data during the operation of the control circuit 18. As one of ordinary skill in the art would understand, the memory 20 includes a main buffer 21a and a second buffer 21b. The main buffer 21a is utilized for storing the predetermined data to be written into a user data area on the optical disc 22. The second buffer 21b is utilized for storing the predetermined data to be written into a spare area on the optical disc 22. The optical disc 22 includes tracks 24 for recording data. Accordingly, when the optical disc 22 is placed on the carrier 14, the motor 12 can drive the carrier 14 and drive the optical disc 22 to rotate. That is, as the optical disc 22 is rotating, the tracks 24 of the optical disc 22 pass through the pick-up head 16. As the tracks 24 pass through the pick-up head 16 the control circuit 18 can store data onto or read data from the tracks 24 utilizing the pick-up head 16. The control circuit 18 stores and reads data onto and from the optical disc 22 according to a host 26. The host 26 can be a computer system, such as a personal computer, or a backend of a DVD recorder.
For a recordable optical disc, a certain location on the optical disc could be perceived as a “defect” because of any number of factors affecting the optical disc, such as: damage to the surface of the optical disc, a change in the material characteristic of the optical disc, or a disturbance in the minute particles. The specific location corresponding to a defect cannot be utilized for storing data correctly. Improvements to the recording function of the recordable optical disc will result in increased stability of the optical disc. A defect managing mechanism is proposed in the conventional optical disc specification. One of the most popular defect managing mechanisms provides a spare data area on the optical disc. As is well known, a defective part on the optical disc cannot be utilized for recording data correctly. As a result, when a defective part is identified the data that is originally recorded in the defect part will be further recoded into the spare area of the optical disc. The recording function of the optical disc, therefore, will not be influenced by the defective part. Please refer to FIG. 2. FIG. 2 is a schematic diagram illustrating the allocation of a lead-in area 27a, a user data area 27b, and a spare area 27c on the optical disc 22 shown in FIG. 1. The optical disc 22 (e.g., a conventional digital versatile disc), the user data area 27b includes a plurality of physical blocks 28a, 28b, 28c, and 28d; these are utilized for storing user data. The spare area 27c includes a plurality of physical blocks 28e, 28f, and 28g; these are utilized for storing spare data. Please note, for brevity only seven physical blocks are shown in FIG. 2. The lead-in area 27a includes a Defect Management Area (DMA) 29 for storing a Defect List Table 25, wherein the Defect List Table 25 includes a plurality of entries 23a and 23b. Each entry 23a or 23b is used for storing a defect physical block number (Defect PBN) that corresponds to the defect portion in the user data area 27b. Additionally, each entry also stores a replacement physical block number (Replacement PBN) that corresponds to the data in the spare area 27c. For example, if the physical blocks 28b and 28c have defects, the entry 23a will record the defect physical block number DPBN (28b) that corresponds to the physical block 28b and the replacement physical block number RPBN (28e) that corresponds to the physical block 28e. Additionally, the other entry 23b will record the defect physical block number DPBN (28c) that corresponds to the physical block 28c and the replacement physical block number RPBN (28f) that corresponds to the physical block 28f. Please note that, for brevity, FIG. 2 shows only the lead-in area 27a, the user data area 27b, and the spare area 27c and does not show the lead-out area.
During the process of recording data onto the optical disc 22, if the pick-up head 16 encounters a defect physical block number that is recorded in the Defect List Table 25, on the optical disc 22, the optical disc drive 10 must transfer the data in the defect physical block into a corresponding replacement physical block. That is, according to the information recorded in the Defect List Table 25, the data written in the physical block 28b will further be written into the physical block 28e, and the data written in the physical block 28c will further be written into the physical block 28f. Please note, the situation where data is over-written before being recorded on the optical disc during the data recording process must be avoided. Otherwise, the recorded data will be certain to contain errors.
Please refer to FIG. 1, FIG. 2, FIG. 3, and FIG. 4 simultaneously. FIG. 3 is a schematic diagram illustrating a first conventional data managing method applied in the memory 20 shown in FIG. 1. FIG. 4 is a flowchart illustrating management of the data corresponding to defects according to the first conventional data managing method. As shown in FIG. 1, the memory 20 includes a main buffer 21a and a second buffer 21b. The operation of the first conventional data managing method is detailed as follows:
Step 400: Are all of the user data written? If yes, proceed to step 460; otherwise, proceed to step 410.
Step 410: After the main buffer 21a receives the user data through the host 26, wherein the data length of the user data is not exceeding the buffer length of the main buffer 21a, suspend the main buffer 21a from receiving the user data, and after writing the data stored in the main buffer 21a into the user data area 27b of the optical disc 22, suspend from writing the data stored in the main buffer 21a into the optical disc 22.
Step 420: Does the main buffer 21a have the data corresponding to a defect? If yes, proceed to step 430; otherwise, return to step 400.
Step 430: Transfer the data corresponding to the defect, stored in the main buffer 21a, to the second buffer 21b. 
Step 440: Check if the amount of data stored in the second buffer 21b reaches a predetermined value. If yes, proceed to step 450; otherwise, return to step 400.
Step 450: Drive the optical disc drive 10 to perform a seek to the spare area 27c, write the data stored in the second buffer 21b into the spare area 27c, perform a seek from the spare area 27c back to the user data area 27b, and then return to step 400.
Step 460: End data writing.
As shown in FIG. 3, at time T11 the main buffer 21a stores a partial data DATA11 corresponding to a user data according to its buffer length. The main buffer 21a is then suspended from storing following data corresponding to the user data. Next, the optical disc drive 10 reads the buffered partial data DATA11 and writes the partial data DATA11 into the user data area 27b on the optical disc 22. The writing process is suspended after writing the partial data DATA11 (step 410) is finished. Meanwhile, there is no data corresponding to a defect in the main buffer 21a (step 420), therefore, in time T12 the main buffer 21a continues to store the next partial data DATA12, which includes data (data11) corresponding to a defect, according to the buffer length. Similarly, the optical disc drive 10 firstly suspends the main buffer 21a from receiving the following partial data corresponding to the user data, reads the partial data DATA12 and further writes the partial data DATA12 into the user data area 27b of the optical disc 22, and then suspends the writing process after writing the partial data DATA12 (step 410) is finished. Because the main buffer 21a has the data (data11) corresponding to a defect (step 420), at time T13 the optical disc drive 10 transfers the data (data11), corresponding to a defect and stored in the main buffer 21a, into the second buffer 21b (step 430). Since the amount of data stored in the second buffer 21b does not reach a predetermined value, for example, the second buffer 21b is not full (step 440), at time T14 the main buffer 21a continues to store the next partial data DATA12, which includes the data (data12) corresponding to a defect according to the buffer length. Similarly, the optical disc drive 10 firstly suspend the main buffer 21a from receiving the following partial data corresponding to the user data, reads the partial data DATA13 and further writes the partial data DATA13 into the user data area 27b of the optical disc 22, and then suspends the writing process after writing the partial data DATA13 (step 410) is finished. Meanwhile, because the main buffer 21a has the data (data12) corresponding to a defect (step 420), at time T15 the optical disc drive 10 transfers the data (data12) corresponding to a defect, and stored in the main buffer 21a, into the second buffer 21b (step 430). Since the amount of data stored in the second buffer 21b does not reach a predetermined value, for example, the second buffer 21b is not full (step 440), the main buffer 21a continues to store the following partial data corresponding to the user data according to the buffer length. At time T1′, the main buffer 21a stores a partial data DATA1′, and the amount of data stored in the second buffer 21b reaches a predetermined value (e.g., the second buffer 21b is full). Therefore, the optical disc drive 10 performs a seek to the spare area 27c, and writes the data (data11-data1′) stored in the second buffer 21b into the spare area 27c. The above-mentioned steps are repeated until all of the user data are written on the optical disc 22 (steps 400 and 460).
Please refer to FIG. 1, FIG. 2, FIG. 5, and FIG. 6 simultaneously. FIG. 5 is a schematic diagram illustrating a second conventional data managing method applied to the memory 20 shown in FIG. 1. FIG. 6 is a flowchart illustrating management of the data corresponding to defects according to the second conventional data managing method. The operation of the second conventional data managing method is detailed as follows:
Step 600: Are all of the user data written? If yes, proceed to step 650; otherwise, proceed to step 610.
Step 610: A micro-controller (not shown) in the control circuit 18 first calculates a predetermined length between the address of the current data and the starting address of data corresponding to a next defect of the optical disc 22.
Step 615: The main buffer 21 a receives the user data corresponding to the predetermined length through the host 26. After the data stored in the main buffer 21a with the predetermined length is written into the user data area 27b of the optical disc 22, suspend from writing the data stored in the main buffer 21a into the optical disc.
Step 616: After the main buffer 21a receives the user data of a data length not exceeding the buffer length of the main buffer 21a through the host 26, suspend the main buffer 21a from receiving the user data, and after the data stored in the main buffer 21a is written into the user data area 27b of the optical disc 22, suspend from writing the data stored in the main buffer 21a into the optical disc 22.
Step 620: Transfer the data corresponding to the defect, and stored in the main buffer 21a, to the second buffer 21b. 
Step 630: Check if the amount of data stored in the second buffer 21b reaches a predetermined value. If yes, proceed to step 640; otherwise, return to step 600.
Step 640: Drive the optical disc drive 10 to perform a seek to the spare area 27c, write the data stored in the second buffer 21b into the spare area 27c, perform a seek from the spare area 27c back to the user data area 27b, and then return to step 600.
Step 650: End data writing.
The control circuit 18 first calculates a predetermined length between the address of the current partial data DATA21 corresponding to the user data and the starting address of the data (data21) corresponding to a next defect of the optical disc 22 (step 610). The main buffer 21a receives the user data of the predetermined length through the host 26, and the optical disc drive 10 writes the data stored in the main buffer 21a into the user data area 27b of the optical disc 22. As shown in FIG. 5, at time T21 the main buffer 21a receives data bits of the partial data DATA21. Additionally, the optical disc drive 10 reads the data bits of the partial data DATA21 currently stored in the main buffer 21a for data recording where at this time the main buffer 21a has not yet received all of the data bits of the partial data DATA21. However, at time T22, the main buffer 21a has received all data bits of the partial data DATA21. Therefore, the host 26 then suspends from transferring data into the main buffer 21a, while the optical disc drive 10 continues the writing process. At time T23, the optical disc drive 10 finishes writing all of the data in the main buffer 21a into the user data area 27b of the optical disc 22 (i.e., the user data of the predetermined length has been completely written). Next, the optical disc drive 10 suspends the data writing process (step 615). At time T24, the main buffer 21a receives the next partial data DATA22 corresponding to the user data according to the buffer length. Please note that, the initial data of the partial data DATA22 is the data (data21) corresponding to a defect. The optical disc drive 10 firstly suspends the main buffer 21a from receiving any following data corresponding to the user data, reads the partial data DATA22 and further writes the partial data DATA22 into the user data area 27b of the optical disc 22, and then suspends the writing process after writing the partial data DATA22 (step 616) is finished. Meanwhile, because the main buffer 21a has the data (data21) corresponding to a defect, at time T25 the optical disc drive 10 transfers the data (data21) corresponding to the defect, and stored in the main buffer 21a, into the second buffer 21b (step 620). Since the amount of data stored in the second buffer 21b does not reach a predetermined value, for example, the second buffer 21b is not full (step 630), then return to step 600. As shown in FIG. 5, at time T2′, the main buffer 21a stores a partial data DATA2′, and the amount of data stored in the second buffer 21b reaches a predetermined value (e.g., the second buffer 21b is full). Therefore, the optical disc drive 10 performs a seek to the spare area 27c , and writes the data (data21-data2′) stored in the second buffer 21b into the spare area 27c (step 640). The above-mentioned steps are repeated until all of the user data are written onto the optical disc 22 (steps 600 and 650).
Please refer to FIG. 1, FIG. 2, FIG. 7, and FIG. 8 simultaneously. FIG. 7 is a schematic diagram illustrating a third conventional data managing method applied to the memory 20 shown in FIG. 1. FIG. 8 is a flowchart illustrating management of the data corresponding to defects according to the third conventional data managing method. The operation of the third conventional data managing method is detailed as follows:
Step 800: Are all of the user data written? If yes, proceed to step 850; otherwise, proceed to step 810.
Step 810: A micro-controller (not shown) in the control circuit 18 first calculates a predetermined length between the address of the current data and the starting address of data corresponding to a next defect of the optical disc 22.
Step 815: The main buffer 21a receives the user data of the predetermined length plus the buffer length of the main buffer 21a through the host 26. After the data stored in the main buffer 21a with the predetermined length plus the buffer length of the main buffer 21a is written into the user data area 27b of the optical disc 22, suspend from writing the data stored in the main buffer 21a into the optical disc.
Step 830: Check if the amount of data stored in the second buffer 21b reaches a predetermined value. If yes, proceed to step 840; otherwise, return to step 800.
Step 840: Drive the optical disc drive 10 to perform a seek to the spare area 27c, write the data stored in the second buffer 21b into the spare area 27c, perform a seek from the spare area 27c back to the user data area 27b, and then return to step 800.
Step 850: End data writing.
The control circuit 18 first calculates a predetermined length between the address of the current partial data DATA31 corresponding to the user data and the starting address of a data (data31) corresponding to a next defect of the optical disc 22 (step 810). The main buffer 21a receives the user data of the predetermined length plus the buffer length of the main buffer 21a through the host 26, and the optical disc drive 10 writes the data stored in the main buffer 21a into the user data area 27b of the optical disc 22. As shown in FIG. 7, at time T31 the main buffer 21a receives data bits of the partial data DATA31 according to the buffer length. Additionally, the optical disc drive 10 reads the data bits of the partial data DATA31 currently stored in the main buffer 21a for data recording. At this time, the main buffer 21a has not yet received all data bits of the partial data DATA31 with the predetermined length plus the buffer length. At time T32, the main buffer 21a finishes receiving all data bits with the predetermined length plus the buffer length (the initial data of the partial data DATA32 is the data (data31) corresponding to a defect). Therefore, the host 26 then suspends from transferring data into the main buffer 21a, and the optical disc drive 10 continues the writing process. At time T33, the optical disc drive 10 finishes writing all of the data in the main buffer 21a into the user data area 27b of the optical disc 22. Next, the optical disc drive 10 suspends the writing process of the partial data DATA32 (step 815). Meanwhile, because the main buffer 21a has the data (data31) corresponding to a defect, at time T34 the optical disc drive 10 transfers the data (data31) corresponding to a defect, and stored in the main buffer 21a, into the second buffer 21b (step 820). The amount of data stored in the second buffer 21b does not reach a predetermined value, for example, the second buffer 21b is not full (step 830). As shown in FIG. 7, at time T3′, the main buffer 21a stores a partial data DATA3′, and the amount of data stored in the second buffer 21b reaches a predetermined value (e.g., the second buffer 21b is full). Therefore, the optical disc drive 10 performs a seek to the spare area 27c, and writes the data (data31-data3′) stored in the second buffer 21b into the spare area 27c (step 840). The above-mentioned steps are repeated until all of the user data are written on the optical disc 22 (steps 800 and 850).
Please refer to FIG. 1, FIG. 2, FIG. 9, and FIG. 10 simultaneously. FIG. 9 is a schematic diagram illustrating a fourth conventional data managing method applied to the memory 20 shown in FIG. 1. FIG. 10 is a flowchart illustrating management of the data corresponding to defects according to the fourth conventional data managing method. The operation of the fourth conventional data managing method is detailed as follows:
Step 1000: Are all of the user data written? If yes, proceed to step 1050; otherwise, proceed to step 1010.
Step 1010: The main buffer 21a first receives the user data through the host 26 and then the optical disc drive 10 directly writes the received user data into the optical disc 22.
Step 1015: After the main buffer 21a receives a data corresponding to a defect on the optical disc 22, the main buffer 21a suspends from receiving the user data, and the optical disc drive 10 suspends from writing the data stored in the main buffer 21a into the optical disc 22.
Step 1020: Transfer the data corresponding to a defect, and stored in the main buffer 21a, to the second buffer 21b. 
Step 1030: Check if the amount of data stored in the second buffer 21b reaches a predetermined value. If yes, proceed to step 1040; otherwise, return to step 1000.
Step 1040: Drive the optical disc drive 10 to perform a seek to the spare area 27c, write the data stored in the second buffer 21b into the spare area 27c, perform a seek from the spare area 27c back to the user data area 27b, and then return to step 1000.
Step 1050: End data writing.
As shown in FIG. 9, at time T41, the host 26 transfers the partial data DATA41 corresponding to a user data into the main buffer 21a. The optical disc drive 10 then reads the partial data DATA41 and further writes the partial data DATA41 into the user data area 27b of the optical disc 22 (step 1010). Next, at time T42, since the main buffer 21a receives the data (data41) corresponding to a defect from the host 26, the main buffer 21a suspends from receiving the following partial data DATA41 corresponding to the user data. Meanwhile, the optical disc drive 10 suspends from writing the data stored in the main buffer 21a into the optical disc 22 (step 1015). Next, at time T43, the optical disc drive 10 transfers the data (data41) corresponding to a defect in the main buffer 21a into the second buffer 21b (step 1020). Since the amount of data stored in the second buffer 21b does not reach a predetermined value, for example, the second buffer 21b is not full (step 1030), the host 26 allows the optical disc drive 10 to continue transferring the partial data DATA41 corresponding to the user data into the main buffer 21a. Then the optical disc drive 10 continues reading the partial data DATA41 and further writing the partial data DATA41 into the user data area 27b of the optical disc 22. At time T4′, since the amount of data stored in the second buffer 21b reaches a predetermined value (e.g., the second buffer 21b is full), the optical disc drive 10 performs a seek to the spare area 27c, and writes the data (data41-data4′) stored in the second buffer 21b into the spare area 27c. The above-mentioned steps are repeated until all of the user data are written onto the optical disc 22 (steps 1000 and 1050).
Please refer to FIG. 1, FIG. 2, FIG. 11, and FIG. 12 simultaneously. FIG. 11 is a schematic diagram illustrating a fifth conventional data managing method applied to the memory 20 shown in the FIG. 1. FIG. 12 is a flowchart illustrating management of the data corresponding to defects according to the fifth conventional data managing method. The operation of the fifth conventional data managing method is detailed as follows:
Step 1200: Are all of the user data written? If yes, proceed to step 1250; otherwise, proceed to step 1210.
Step 1210: The main buffer 21a first receives the user data through the host 26 and then the optical disc drive 10 directly writes the received user data into the optical disc 22.
Step 1215: After the main buffer 21a receives a data corresponding to a defect on the optical disc 22, the optical disc drive 10 drives the main buffer 21a to store an additional section of the user data following the data corresponding to a defect where data length of the additional section is equal to a buffer length of the main buffer 21a, and then suspends the main buffer 21a from receiving the user data. Moreover, after writing the data stored in the main buffer 21a is finished, suspend from writing the data stored in the main buffer 21a into the optical disc 22.
Step 1220: Transfer the data corresponding to a defect, and stored in the main buffer 21a, to the second buffer 21b. 
Step 1230: Check if the amount of data stored in the second buffer 21b reaches a predetermined value. If yes, proceed to step 1240; otherwise, return to step 1200.
Step 1240: Drive the optical disc drive 10 to perform a seek to the spare area 27c, write the data stored in the second buffer 21b into the spare area 27c, perform a seek from the spare area 27c back to the user data area 27b, and then return to step 1200.
Step 1250: End data writing.
As shown in FIG. 11, at time T51, the host 26 transfers the partial data DATA51 corresponding to a user data into the main buffer 21a. The optical disc drive 10 then reads the partial data DATA51 and further writes the partial data DATA51 into the user data area 27b of the optical disc 22 (step 1210). At time T52, since the main buffer 21a does not receive any data corresponding to a defect, the optical disc drive 10 does not suspend the writing process. Next, at time T53, since the main buffer 21a receives the data (data51) corresponding to a defect, the main buffer 21a then stores an additional section of the user data following the starting address of the data (data51) where data length of the additional section is equal to a buffer length of the main buffer 21a. After the optical disc drive 10 finishes writing the data stored in the main buffer 21a into the optical disc 22, the optical disc drive 10 suspends from writing the data stored in the main buffer 21a into the optical disc 22 (step 1215). Next, at time T54, the optical disc drive 10 transfers the data (data51) corresponding to a defect, and stored in the main buffer 21a, into the second buffer 21b (step 1220). Since the amount of data stored in the second buffer 21b does not reach a predetermined value, for example, the second buffer 21b is not full (step 1230), the host 26 allows the optical disc drive 10 to continue transferring the partial data DATA51 corresponding to the user data into the main buffer 21a. Then the optical disc drive 10 continues reading the partial data DATA51 and further writing the partial data DATA51 into the user data area 27b of the optical disc 22. At time T5′, since the amount of data stored in the second buffer 21b reaches a predetermined value (e.g., the second buffer 21b is full), the optical disc drive 10 then performs a seek to the spare area 27c, and writes the data (data51-data5′) stored in the second buffer 21b into the spare area 27c. The above-mentioned steps are repeated until all of the user data are written onto the optical disc 22 (steps 1200 and 1250).
As mentioned earlier, in the first conventional data managing method it is necessary to suspend from receiving the user data and writing the data stored in the main buffer 21a into the optical disc 22 each time the user data of a buffer length of the main buffer 21a is received. Therefore, the number of times of data recording suspension is substantially equal to the result of dividing the user data by the buffer length. Among the related art methods described earlier, this method has the maximum suspension times and the poorest data management efficiency.
The second conventional data managing method is similar to the fourth conventional data managing method. Referring to the above-mentioned flows, the major difference between the second conventional data managing method and the fourth conventional data managing method being that the second data managing method makes use of a firmware means (i.e., a predetermined firmware is utilized to control the micro-controller inside the control circuit 18) to calculate the starting address of the data corresponding to a defect, and stored in the main buffer, and then suspend the data receiving and data writing. While in the fourth data managing method additional hardware (not shown) can be utilized to suspend the data receiving and data writing after storing a data in the main buffer 21a corresponding to a defect on the optical disc 22. It is realized from this description that the data managing efficiency of the fourth conventional data managing method using the hardware monitoring scheme is better than that of the second conventional data managing method.
The third conventional data managing method and the fifth conventional data managing method are improved methods based on the second conventional data managing method and the fourth conventional data managing method, respectively. In both the third conventional data managing method and the fifth conventional data managing method the optical disc drive 10 drives the main buffer 21a to store an additional section of the user data with a buffer length of the main buffer 21a while receiving the data correspond to a defect, and then suspends data receiving and data writing. Therefore, the number of times of data recording suspension in both methods is equal to the result of dividing all the user data by an increased buffer length having one more buffer length added, and thus the number of times that data recording suspension is necessary is reduced accordingly.
As mention above, the most efficient related art method is the above-mentioned fifth conventional data managing method, and next are the third method, the fourth method, the second method, and the first method in order of decreasing efficiency. However, when the defects happen more frequently, the data managing efficiency of the fifth conventional data managing method becomes the same as the first conventional data managing method due to the limitation of the buffer length. Moreover, while receiving a data corresponding to a defect, the main buffer 21a is capable of receiving only one more section of the user data of the buffer length. Then the main buffer 21a is forced to suspend from receiving the user data. Therefore, the main buffer 21a cannot avoid the need to suspend at least a certain number of times for receiving all of the user data. However, during each data recording suspension, the optical disc drive must dedicate time for the short seek to perform. More defects directly results in more suspension times. Furthermore, it follows that as the number of suspensions increases, the associated cost likewise increases. This result causes data recording inefficiency that cannot be improved.